<?php 
include ('connection.php');
$query=mysql_query("select * from airport_code");
?>
<table width="1000" border="1">
  <th width="150">Sr. No.</th><th width="150">1st Airport Code</th><th width="200">1st Airport Name</th><th width="75">1st Rank</th><th width="150">2nd Airport_code</th><th width="200">2nd Airport Name</th><th width="75">2nd Rank</th><tr>
<?php $i=1;
while($row=mysql_fetch_array($query)){
$q=mysql_query("select distinct airport_code,airport_name,rank from citycodes where airport_code='$row[airport_code]'");
$r=mysql_fetch_array($q);
 //$in=mysql_query("update airport_code set rank='$r[rank]' where airport_code='$row[airport_code]'");
 //if(!$in){
	// die("error");
// }
	?>
      <td><?php echo $i; ?>&nbsp;</td>
  <td><?php echo $r['airport_code']; ?>&nbsp;</td>
    <td><?php echo $r['airport_name']; ?>&nbsp;</td>
    <td><?php echo $r['rank']; ?>&nbsp;</td>
    <td><?php echo $row['airport_code']; ?>&nbsp;</td>
    <td><?php echo $row['name']; ?>&nbsp;</td>
    <td><?php echo $row['rank']; ?>&nbsp;</td>
</tr>  

<?php 	$i++;
}
?>

</table>
